#include <bits/stdc++.h>

using namespace std;
#define int long long
const int inf = 0x3f3f3f3f;

void solve()
{
	int n, q;
	cin >> n >> q;
	vector<int> a(n + 1, 0);
	int ans = 0;
	for (int i = 0; i < q; i++)
	{
		int x;
		cin >> x;
		if (a.size() == 2)
		{
			ans ^= 1;
			cout << ans << '\n';
		}
		else if (a[x] == 0)
		{
			a[x] = 1;
			if (x == 1) ans += a[x + 1] == 0;
			else if (x == n) ans += a[x - 1] == 0;
			else if (a[x - 1] == 1 && a[x + 1] == 1) ans--;
			else ans += a[x - 1] == 0 && a[x + 1] == 0;
			cout << ans << '\n';
		}
		else
		{
			a[x] = 0;
			if (x == 1) ans -= (a[x + 1] == 0);
			else if (x == n) ans -= (a[x - 1] == 0);
			else
			{
				if (a[x - 1] == 0 && a[x + 1] == 0) ans -= 1;
				else if (a[x - 1] == 1 && a[x + 1] == 1) ans += 1;
			}
			cout << ans << '\n';
		}
	}
}

signed main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	int _ = 1;
	// cin >> _;
	while (_--)
	{
		solve();
	}
	return 0;
}